<?php
/**
 * Created by PhpStorm.
 * Date: 2018/10/16
 * Time: 下午3:38
 */?>
<?php

if ( ! defined('BASEPATH'))
{
    exit('No direct script access allowed');
}

/*
 *
 * 视图框架
 * Created on 2012-9-24
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
class frameset extends CI_Controller
{
    /**
     *构造函数
     *
     * 登陆检验
     */
    function __construct()
    {
        //echo "19919191919191";
        parent::__construct();
        if($_POST) {
            $_SESSION['user_id'] = $_POST["session_user_id"];
            $_SESSION['user_name'] = $_POST["session_user_name"];
            $_SESSION['role_id'] = $_POST["session_role_id"];
            $_SESSION['logged_in'] = $_POST["session_logged_in"];
            //print_r($_POST);
            //print_r(@$_SESSION['logged_in']);

        }

        //print_r($_POST['session']);
        if (@$_SESSION["logged_in"]==0)      //=============================================!!!!!!!!!!!!!!!!!!!!!!!
        {
            //print_r($_SESSION);
            redirect('c_login');

            exit();
        }
/*
        if(!$this->session->userdata('logged_in'))      //=============================================!!!!!!!!!!!!!!!!!!!!!!!
        {
            $_SESSION=$_POST["session"];
            //print_r($_POST);
            //print_r($_SESSION);
            if(!@$_SESSION['logged_in'])      //=============================================!!!!!!!!!!!!!!!!!!!!!!!
            {
                redirect('c_login');
                exit();
            }

        }
*/
    }

    //-------------------------------------------------------------------------------------------------------
    /**
     * 框架集
     *
     *
     */
    function index()
    {
        //echo "aaaaaaaaaaaaaaaaa";
        if(@$_SESSION['role_id']==1)
            $this->load->view('_frameset');  //登陆后初始化界面为书籍界面
        else
            $this->load->view('_frameset_low');
    }

    //------------------------------------------------------------------------------------------------------------
    /**
     *顶部菜单
     *
     *
     */
    function top()
    {
        //echo "aaaaaaaaaaaaaaaaa";
        $this->load->view('_top');
    }

    //-----------------------------------------------------------------------------------------------------
    /**
     * 左侧菜单
     *
     *
     */       //menu($type = 'dashboard')
    function menu($type = 'books')
    {
        //echo "aaaaaaaaaaaaaaaaa";
        switch($type)
        {
            case 'books'   : $this->load->view('books/menu');   break;   //1书籍
            case 'reader' : $this->load->view('reader/menu');   break;	 //2读者
            case 'news'    : $this->load->view('news/menu');	break;   //3新闻
            case 'message' : $this->load->view('message/menu'); break;   //4留言
            case 'borrow'  : $this->load->view('borrow/menu');  break;   //5借阅
            case 'admin'   : $this->load->view('admin/menu');   break;   //6管理员
            case 'systems'  : $this->load->view('system/menu');	break;   //7 系统设置
        }
    }
}
?>

